import Vue from "vue";
import Router from "vue-router";


Vue.use(Router);

export default new Router(
    {
        mode: "history",
        routes: [
            {
                path: "/",
                name: "home",
                component: () => import('../view/article/articles'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '首页'
                }

            },
            {
                path: "/articles",
                name: "articles",
                component: () => import('../view/article/articles'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '文章'
                }


            },
            {
                path: "/tags",
                name: "tags",
                redirect: '/tags/-1',
                component: () => import('../view/tags/tags'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '标签'
                }
            },
            {
                path: "/tags/:tagsId",
                name: "tags",
                component: () => import('../view/tags/tags'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '标签'
                }
            },
            {
                path: "/category",
                name: "category",
                redirect: '/category/-1',
                component: () => import('../view/category/category'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '分类'
                }
            },
            {
                path: "/category/:categoryId",
                name: "category",
                component: () => import('../view/category/category'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '分类'
                }
            },
            {
                path: "/search/:keyWorld",
                name: "search",
                component: () => import('../view/search/search'),
                meta: {
                    keepAlive: false, //此组件需要被缓存
                    title: '搜索'
                }
            },
            {
                path: "/timeline",
                name: "timeline",
                component: () => import('../view/timeline/timeline'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '历程'
                }
            },
            {
                path: "/about",
                name: "about",
                component: () => import('../view/about/about'),
                meta: {
                    keepAlive: true, //此组件需要被缓存
                    title: '关于我'
                }
            },
            {
                path: "/articles/articleDetail/:articleId",
                name: "articleDetail",
                component: () => import('../view/article/articleDetail'),
                meta: {
                    keepAlive: false, //此组件不需要被缓存
                }
            }



        ]
    }
);
